import {Paging} from "../../utils/paging";
import {delUserDrug, getUserDrugList} from "../../api";

class PatientList{


    static getLatestPaging(baseUrl) {
        return new Paging({
            url: `${baseUrl}ucenter/getUserDrugList`
        })
    }

    static async deletePatient(baseUrl, id) {
        return await delUserDrug(baseUrl, {id})
    }

    static async getDefaultPatient(baseUrl) {
        const res = await getUserDrugList({page: 1,limit: 99,is_default: 1},baseUrl)
        const data = res.data.data
        let patients = data.filter((item)=>{
            return item.is_default == '1'
        })
        return patients.length!=0?patients[0] : ''
    }


}

export {
    PatientList
}
